// replication code //
// appendices //

** Appendix H: Alternative Specifications andf Robustness Checks **

// before the replication: open the dataset, define clusters on state level (for MLM)

xtset cowcode 

******************************************
* table H1 - strength of targeted nativism

* M1
xtreg RRperc_vote GroupEstimate indexdistinctiveness i.year, re mle
estimates store po1

* M2
xtreg RRperc_vote GroupEstimate EthnicPerVote i.year, re mle
estimates store po2
 
* M3
xtreg RRperc_vote GroupEstimate EthnicRights i.year, re mle
estimates store po3

* M4
xtreg RRperc_vote GroupEstimate indexdistinctiveness EthnicPerVote EthnicRights i.year, re mle
estimates store po4

* M5
xtreg RRperc_vote GroupEstimate indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re mle
estimates store po5

* fit statistic 
estimates stats po1 po2 po3 po4 po5

********************************************
* figure H1 - comparing OLS and logit models

xtlogit RRParty GroupEstimate indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store logit
xtreg RRperc_vote GroupEstimate indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re mle
estimates store ols

coefplot logit ols, keep(GroupEstimate indexdistinctiveness EthnicPerVote EthnicRights) xlin(0) grid(none) levels(95) ciopts(lwidth(*1 *3))

************************************************************
* table H2 - controlling for historical/immigrant minorities

* M1 *
xtlogit RRParty GroupEstimate HistoricalGroupALL indexdistinctiveness EthnicPerVote EthnicRights i.year, re intpoints(50)
estimates store h1

* M2 *
xtlogit RRParty GroupEstimate HistoricalGroupALL indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy i.year, re intpoints(50)
estimates store h2

* M3 *
xtlogit RRParty GroupEstimate HistoricalGroupALL indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store h3

* fit statistic 
estimates stats h1 h2 h3

**********************************************
* table H3 - controlling for Muslim minorities

xtlogit RRParty GroupEstimate muslimgroup indexdistinctiveness EthnicPerVote EthnicRights i.year, re intpoints(50)
estimates store m1

* M2 *
xtlogit RRParty GroupEstimate muslimgroup indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy i.year, re intpoints(50)
estimates store m2

* M3 *
xtlogit RRParty GroupEstimate muslimgroup indexdistinctiveness EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store m3

* fit statistic 
estimates stats m1 m2 m3

******************************************
* table H4 - nuanced distinctiveness index

* M1
xtlogit RRParty GroupEstimate nuancedDI i.year, re intpoints(50)
estimates store pndi1

* M2
xtlogit RRParty GroupEstimate nuancedDI EthnicPerVote EthnicRights i.year, re intpoints(50)
estimates store pndi2 

* M3
xtlogit RRParty GroupEstimate nuancedDI EthnicPerVote EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store pndi3

* fit statistic 
estimates stats pndi1 pndi2 pndi3

***************************************
* table H5 - ethnic party present in parliament

* M1 *
xtlogit RRParty GroupEstimate indexdistinctiveness EthnicParty EthnicRights i.year, re intpoints(50)
estimates store ep1

* M2 *
xtlogit RRParty GroupEstimate indexdistinctiveness EthnicParty EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy i.year, re intpoints(50)
estimates store ep2

* M3 *
xtlogit RRParty GroupEstimate indexdistinctiveness EthnicParty EthnicRights Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store ep3

* fit statistic 
estimates stats ep1 ep2 ep3

***********************************************
* table H6 - degree of collective ethnic rights

* M1 *
xtlogit RRParty GroupEstimate EthnicRightsDegree i.year, re intpoints(50)
estimates store er1

* M2 *
xtlogit RRParty GroupEstimate indexdistinctiveness EthnicPerVote EthnicRightsDegree i.year, re intpoints(50)
estimates store er2

* M3 *
xtlogit RRParty GroupEstimate indexdistinctiveness EthnicPerVote EthnicRightsDegree Unemployment ParlRegime MeanDM FedDec v2x_polyarchy CommLegacy i.year, re intpoints(50)
estimates store er3

* fit statistic 
estimates stats er1 er2 er3
